<?php
$oAppconfig = AppconfigHandler::getConfig();
$oUsergroups = UsergroupHandler::getUsergroups();
$oUsers = UserHandler::getUsers();
$oAppconfig = AppconfigHandler::getConfig();
$sUsergroupAccess = $oUsers[$_SESSION['rid']]->getUsergroups(true);
?>

<table class="boxborder" cellspacing="0">
	<tr>
		<td class="boxhandle" colspan="2"><?php print msg('Usergroups') ?></td>
	</tr>
	<tr>
		<td class="control small" colspan="2">
			<a href="index.php?sView=user-list"><?php print msg('Users') ?></a> | <?php print msg('Usergroups') ?> |
		</td>
	</tr>
	<tr>
		<td class="listtop center">
<?php
if (@$oAppconfig['bFreeUsergroups'] || $oUsers[$_SESSION['rid']]->bAdmin)
{
	echo '<a href="javascript: showBox(\'usergroup-add\');"><img src="images/'.$_SESSION['oUserVars']['images'].'/usergroup-add.png" border="0"></a>';
}
else
{
	echo '&nbsp;';
}
?>
		</td>
		<td class="listtop"><?php print msg('Name') ?></td>
	</tr>
<?php
foreach ($oUsergroups as $iThisUsergroupID => $oThisUsergroup)
{
	?>
	<tr>
		<td class="listentity center small nowrap">
	<?php
	if ($sUsergroupAccess[$iThisUsergroupID] == 'admin')
	{
		?>
			<a href="javascript: showBox('usergroup-delete', 'iUsergroup=<?php print $iThisUsergroupID ?>')"><img src="images/<?php print $_SESSION['oUserVars']['images'] ?>/usergroup-delete.png" border="0"></a>
			<a href="javascript: showBox('usergroup-change', 'iUsergroup=<?php print $iThisUsergroupID ?>')"><img src="images/<?php print $_SESSION['oUserVars']['images'] ?>/usergroup-change.png" border="0"></a>
		<?php
	}
	else
	{
		echo '&nbsp;';
	}
	?>
		</td>
		<td class="listentity"><a href="index.php?sView=usergroup-view&iUsergroup=<?php print $iThisUsergroupID ?>"><?php print $oThisUsergroup->sName ?></a></td>
	</tr>
	<?php
}
?>
</table>
